﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Common;

public partial class membership_changepassword : MemberPageBase
{
    protected void Page_Load(object sender, EventArgs e)
    {
        Response.Expires = -1;

        PageBegin();

        if (RequestBase.GetFormString("___EVENTTARGET") == "changepassword")
        {
            SaveChange();
        }

        if (!IsPostBack)
            txtUsername.Value = this.UserName; 
    }
    void SaveChange()
    {
        Model.Enum.MembershipCreateStatus status = Model.Enum.MembershipCreateStatus.ProviderError;
        (new BLL.MembershipBase()).ChangePassword(RequestBase.GetFormString("txtUsername"), RequestBase.GetFormString("txtPassword"), out status);

        switch ((int)status)
        {
            case 0:
                JScript.Alert("密码修改成功!");
                break;
            default:
                divErrorMsg.Style.Add("display", "");
                divErrorMsg.InnerHtml = string.Format(divErrorMsg.InnerHtml, "<li style=\"background: none;\">" + status.ToString() + "</li>"); 
                break;
        }
    }
}